Skip to main content

yPopup

Description

The yPopup is an element to be used to display content inside a popup. It resembles the yPage in nearly every aspect.

Some uses for the yPopup are:

Basic Structure

The basic structure of the yPopup shall be explained in the following. For the general structure of a yComponent please visit the YBase-components basic-structure.

Popup structure

The yPopup as seen above can contain a header and footer and always includes content inbetween.

The header can be toggled on/off by changing the Popup__Display-Type. It contains a title and an icon on the left side and a close button on the right.

Content

The content is the actual center of the component itself. It basically mimics a container which can be designed and filled like a yPage.

The footer as a specific submodule of the yPopup, can also be toggled equal to the header. It contains two action buttons on the right that can be modified if needed. These two buttons represent a cancel and a submit button which can trigger events.

Properties

Through its various properties the yPopup can be configured to suit your needs. The display below provides you with an overview of all the yPopup properties.

Properties can be changed directly through three methods:

  • Inside the Toolbar, which is positioned in your workarea next to your component right where you need it. It shows the most important properties, thus providing a fast and efficient way to configure your component in the most basic way.
  • It may also occur in the Toolbar Extension, which is a seamless extension accesible as a dropdown item of the Toolbar. It extends the functionality of the Toolbar by providing advanced pickers for the most used properties.
  • Inside the Detail Panel, which is located in the righthand drawer. Every property of a component can be configured here.
METAread more
--y-popup__component-id

The identifier of the component that is unique within a page.

--y-popup__component-type

The type of the component. For this component it is -popup.

--y-popup__name

The custom name of the component. It serves for better identification of the component.

--y-popup__version

The custom version of the Popup-component. This can be used to ensure that all components work well together.

--y-popup__core-theme

The CoreTheme, which will be apllied to the Popup. For further information on themes visit the themes page.

--y-popup__sub-theme

The subtheme subordinated to the previously specified CoreTheme, which will be apllied to the Popup. For further information on themes visit the themes page.

--y-popup__group-theme

The group theme is a further variation of the subtheme which is specified especially for variations of a component inside the subtheme. For further information on themes visit the Theme-Manager page.

DISPLAYread more
--y-popup__display

This property specifies the display behavior of the component. This can be be set to:

  • none
  • block
  • flex
  • inline
--y-popup__position

This property specifies the type of positioning method used for the component. This can be be set to:

  • static
  • relative
  • absolute
  • sticky
  • fixed
--y-popup__visible

This property can toggle the visibility of the component. The two modes are completely hidden and fully shown.

SIZEread more
--y-popup__min-width

The minimum value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
--y-popup__min-height

The minimum value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %

The value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • auto

The value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • auto
--y-popup__max-width

The maximum value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • none
--y-popup__max-height

The maximum value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • none
--y-popup__flex

The flex property sets the length on flexible items. This sets the value in n-fold shares extrapolated to all other components with the flex display within the same container.

PLACEMENTread more
--y-popup__margin-top

This property creates a space around the component, outside of the top border. This can be set in percent or pixels.

--y-popup__margin-right

This property creates a space around the component, outside of the right border. This can be set in percent or pixels.

--y-popup__margin-bottom

This property creates a space around the component, outside of the bottom border. This can be set in percent or pixels.

--y-popup__margin-left

This property creates a space around the component, outside of the left border. This can be set in percent or pixels.

--y-popup__padding-top

This property creates a space within the component, inside of the top border. This can be set in percent or pixels.

--y-popup__padding-right

This property creates a space within the component, inside of the right border. This can be set in percent or pixels.

--y-popup__padding-bottom

This property creates a space within the component, inside of the bottom border. This can be set in percent or pixels.

--y-popup__padding-left

This property creates a space within the component, inside of the top border. This can be set in percent or pixels.

Usage

In this section you will find a collection of application scenarios and examples that illustrate how to leverage the yPopup in ways that deviate from its standard behavior, as defined by yBase. This section aims to inspire and guide you through various possibilities, helping you to implement more complex or unique functionalities tailored to your specific needs. General properties that are universally applicable can be found in the yBase usage section.

Displaytype

The yPopup comes with three built-in types.

Popup display type: Empty + Normal
Empty
Popup display type: Header + Info
Header Example1
Popup display type: Header & Footer + Success
Header & Footer
Popup display type: Header + Warning
Header Example2
Popup display type: Header + Error
Header Example3
stylepopuppopup__display-typeempty
stylepopuppopup__display-statenormal
tip
  • Popup__Persistent enables that it can't be closed by clicking away.
  • When enabling Popup__Backdrop, the popup gets a backdrop added, which blurs out the back.
  • Popup__Timed makes the popup time based and closes it automatically after Popup__Duration has passed.

Background

PopupBackgroundExample1
Cover
PopupBackgroundExample2
Repeat
stylebackgroundbg-imagehttps://www.vectorsoft.de/wp-content/uploads/2021/09/yeet_mobile-1024x768.png
stylebackgroundbg-sizecover

Alignment

PopupAlignmentExample1
Row
PopupAlignmentExample2
Column
PopupAlignmentExample3
Wrap
stylealignmentflex-directionrow
stylealignmentjustify-contentcenter
Info: Scroll behavior

If the content exceeds the parent element itself, a scrollbar will appear. When needed, this scrollbar can be removed while keeping scrollability, when toggling the property show-scrollbar to false.

Positioning

To position a yPopup, you have to choose a position inside the PositionPicker.

PopupPositioningExample1
Inner top center
PopupPositioningExample2
Outer bottom center
PopupPositioningExample3
Inner center center
stylepopuppopup__display-typeheader
stylepopupdisplayPositioninner-top-center
stylepopupsourceElementParentYOUR_PAGE
stylepopupsourceElementChildYOUR_ELEMENT

To display a new popup, you need to make some moves for it to be rendered.

How to:

  1. Create a yPage with a yButton component in your application.
  2. Open your yPopup again.
  3. Within the Detail Panel, proceed to the Links section and unfold Open.
  4. Create a new SourceLink for Source-Link-Open to the yButton on the previously created yPage.
    It should look like: y-page:1:y-button:2:click.
tip

The same procedures can be done with any other trigger element and also applys for Source-Link-Close.

Using Submit and Close Event

How to:

You can use the yPopup as a modal dialog and react on user interactions such as submit and close.

  1. Create two yInput inside the yPopup and change their Type to number.
  2. Select the yPopup again.
  3. Within the Detail Panel, proceed to Style section and unfold Popup.
  4. Change the Popup__Display-Type to Header & Footer.
  5. The proceed to the Event section and unfold Input and open EvtSubmit.

Code example:

In this example we have a simple yPopup containing a minified calculator that can only add two values. When the user submits, we read the two input values which should be added and alert the result.

EvtSubmit
// function onPopup_1_EvtSubmit (apiObject, component, eventData) {

const inputA = apiObject.ui.getObject(1, "y-input");
const inputB = apiObject.ui.getObject(2, "y-input");

const num1 = inputA.get("style", "content", "inputNumber");
const num2 = inputB.get("style", "content", "inputNumber");

alert("result: ", num1 + num2);

// }

Using Modal Popup for Multiple Pages

How to:

You can use the yPopup universally on multiple pages inside your project.

  1. Open the Detail Panel and proceed to Style and unfold the group Popup.
  2. Change the Popup__Display-Type to Header & Footer.
  3. Create a yPage with a yButton in your application.
  4. Within the Detail Panel of the yButton, proceed to the Event section and open EvtClicked.

Code example:

In this example the user can call the popupOpen function to open a certain yPopup, when a yButton is clicked.

EvtClicked yButton
// function onButton_5_EvtClicked (apiObject, component, eventData) {

apiObject.popup.popupOpen(1, "y-popup");

// }